﻿using CodeAngel.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeAngel.UI
{
    public class DatabaseViewModel : ViewModel
    {

        #region Database

        /// <summary>
        /// Gets or sets the Database.
        /// </summary>
        public Database Database
        {
            get { return this._database; }
            set
            {
                if (value != this._database)
                {
                    this._database = value;
                    this.RaisePropertyChanged("Database");
                }
            }
        }
        private Database _database;

        #endregion

        #region CreateSqlServerDatabase

        /// <summary>
        /// Creates the respective SQL Server database based on our Database entity.
        /// </summary>
        public void CreateSqlServerDatabase()
        {
            this.Database.CreateSqlServerDatabase();
        }

        /// <summary>
        /// Delegate command that can execute CreateSqlServerDatabase.
        /// </summary>
        public DelegateCommand CreateSqlServerDatabaseCommand
        {
            get
            {
                if (this._CreateSqlServerDatabaseCommand == null) this._CreateSqlServerDatabaseCommand = new DelegateCommand(CreateSqlServerDatabase);
                return _CreateSqlServerDatabaseCommand;
            }
        }
        private DelegateCommand _CreateSqlServerDatabaseCommand;

        #endregion

        #region UpdateSqlServerDatabase

        /// <summary>
        /// Updates the respective SQL Server database based on our Database entity.
        /// </summary>
        public void UpdateSqlServerDatabase()
        {
            this.Database.UpdateSqlServerDatabase();
        }

        /// <summary>
        /// Delegate command that can execute UpdateSqlServerDatabase.
        /// </summary>
        public DelegateCommand UpdateSqlServerDatabaseCommand
        {
            get
            {
                if (this._UpdateSqlServerDatabaseCommand == null) this._UpdateSqlServerDatabaseCommand = new DelegateCommand(UpdateSqlServerDatabase);
                return _UpdateSqlServerDatabaseCommand;
            }
        }
        private DelegateCommand _UpdateSqlServerDatabaseCommand;

        #endregion
    }
}
